package io.renren.modules.taskbasic.controller;

import java.util.Arrays;
import java.util.Map;

import org.apache.shiro.authz.annotation.RequiresPermissions;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import io.renren.modules.taskbasic.entity.TaskbasicinfoEntity;
import io.renren.modules.taskbasic.service.TaskbasicinfoService;
import io.renren.common.utils.PageUtils;
import io.renren.common.utils.R;



/**
 * 
 *
 * @author chenshun
 * @email sunlightcs@gmail.com
 * @date 2022-08-04 17:29:26
 */
@RestController
@RequestMapping("taskbasic/taskbasicinfo")
public class TaskbasicinfoController {
    @Autowired
    private TaskbasicinfoService taskbasicinfoService;

    /**
     * 列表
     */
    @RequestMapping("/list")
    @RequiresPermissions("taskbasic:taskbasicinfo:list")
    public R list(@RequestParam Map<String, Object> params){
        PageUtils page = taskbasicinfoService.queryPage(params);

        return R.ok().put("page", page);
    }


    /**
     * 信息
     */
    @RequestMapping("/info/{tNo}")
    @RequiresPermissions("taskbasic:taskbasicinfo:info")
    public R info(@PathVariable("tNo") Integer tNo){
		TaskbasicinfoEntity taskbasicinfo = taskbasicinfoService.getById(tNo);

        return R.ok().put("taskbasicinfo", taskbasicinfo);
    }

    /**
     * 保存
     */
    @RequestMapping("/save")
    @RequiresPermissions("taskbasic:taskbasicinfo:save")
    public R save(@RequestBody TaskbasicinfoEntity taskbasicinfo){
		taskbasicinfoService.save(taskbasicinfo);

        return R.ok();
    }

    /**
     * 修改
     */
    @RequestMapping("/update")
    @RequiresPermissions("taskbasic:taskbasicinfo:update")
    public R update(@RequestBody TaskbasicinfoEntity taskbasicinfo){
		taskbasicinfoService.updateById(taskbasicinfo);

        return R.ok();
    }

    /**
     * 删除
     */
    @RequestMapping("/delete")
    @RequiresPermissions("taskbasic:taskbasicinfo:delete")
    public R delete(@RequestBody Integer[] tNos){
		taskbasicinfoService.removeByIds(Arrays.asList(tNos));

        return R.ok();
    }

}
